package cn.wjx.taobaounion.ui.activity;

import android.app.Activity;
import android.os.Bundle;
import android.widget.RadioGroup;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.wjx.taobaounion.R;
import cn.wjx.taobaounion.ui.custom.FlowTextLayout;
import cn.wjx.taobaounion.utils.LogUtils;

/**
 * @author WuChangJian
 * @date 2020/6/16 22:28
 */
public class TestActivity extends Activity implements FlowTextLayout.OnFlowTextItemClickListener {

    @BindView(R.id.test_navigation_bar)
    public RadioGroup mRadioGroup;
    @BindView(R.id.test_flow_text_layout)
    public FlowTextLayout flowText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);
        ButterKnife.bind(this);
        initView();
        initListener();
    }

    private void initView() {
        List<String> list = new ArrayList<>();
        list.add("鼠标");
        list.add("电脑");
        list.add("显示器");
        list.add("啤酒");
        list.add("饮料");
        list.add("矿泉水");
        flowText.setTextList(list);
    }



    private void initListener() {
        mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if (checkedId == R.id.test_home) {
                    LogUtils.d(TestActivity.class, "navigation item-->" + "首页");
                }
            }
        });
        flowText.setOnFlowTextItemClickListener(this);
    }

    @Override
    public void onFlowTextItemClick(String text) {
        LogUtils.d(this, "text-->" + text);
    }
}
